package com.qcq.wecheck.util;

import com.qcq.wecheck.dto.AttendanceCountDto;

import java.time.LocalDate;

/**
 * <p>
 * 自定义谓词工具类
 * </p>
 *
 * @author O
 * @version 1.0
 * @since 2018/9/25
 */
public class PredicateUtils {
	public static boolean isNotNullAttendanceCountVo(AttendanceCountDto vo) {
		return vo != null;
	}

	public static boolean isFinishedAttendanceCountVo(AttendanceCountDto dto, int requiredCount) {
		return dto.getCount() >= requiredCount;
	}

	public static boolean isLegalDateAttendanceCountVo(AttendanceCountDto dto) {
		return dto.getDate().isBefore(LocalDate.now())||dto.getDate().isEqual(LocalDate.now());
	}

	public static boolean isUnFinishedAttendanceCountVo(AttendanceCountDto dto, int requiredCount) {
		return dto.getCount() < requiredCount && dto.getCount() > 0;
	}
}
